package Thread;

//第二种创建线程的方式
//实现Runnable接口并重写run方法.

public class CreateThread2 {
    public static void main(String[] args) {
        //单独定义任务
        Runnable runnable1=new MyRunnble1();
        Runnable runnable2=new MyRunnble2();


        Thread thread1=new Thread(runnable1);
        Thread thread2=new Thread(runnable2);

        thread1.start();
        thread2.start();


    }
}
class MyRunnble1 implements  Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("你是谁啊");
        }
    }
}

class MyRunnble2 implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("你猜是我谁");
        }
    }
}

